function [X ResNorm]=optim_fitLorentzian2peak(X,xdata,ydata,ydata_err,LB,UB)
options=optimset('MaxIter',500,'TolFun',1e-8,'Display','iter','TolX',1e-8,'MaxFunEvals',2000);
[X ResNorm]=lsqcurvefit(@nestedfun,X,xdata,ydata./ydata_err,LB,UB,options);
    function out=nestedfun(X,xdata)
        out=fitLorentzian2peak(X,xdata);
        out=out./ydata_err;
    end
end